$(document).ready(function(){
        if(province){
            for(var i in province){
                var selected = '';
                if(thisProvince&& thisProvince==province[i]['areaID']){
                    selected = 'selected';
                }
                jQuery("#province").append('<option value='+province[i]['areaID']+' '+selected+'>'+province[i]['prefix']+' '+province[i]['areaName']+'</option>');
            }
        }

        var  province_id = $("#province").val();

        if(thisCity > 0){
            var citylist =  city[province_id];
            for(var i in citylist){
                var selected = '';
                if(thisCity&& thisCity==citylist[i]['areaID']){
                    selected = 'selected';
                }

                jQuery("#city").append('<option value='+citylist[i]['areaID']+' '+selected+'>'+citylist[i]['areaName']+'</option>');
            }

            if(thisCity > 0){
                get_city(thisCity,'','#area');
            }
        }else if(province_id>0){
            get_city(province_id,'#city','#area');
        }


        $('#province').bind('change',function(){
            if($(this).val()){
                get_city($(this).val(),'#city','#area');
            }
        });

        $('#city').bind('change',function(){
            if($(this).val()){
                get_city($(this).val(),'','#area');
            }
        });
    });
    function get_city(pid,obj,child){
        if(pid){
            if(obj) $(obj).html("<option value=''>市/地区</option>");
            if(child) $(child).html(" <option value=''>县/市</option>");

            if(obj){
                var citylist = city[pid];
                if(citylist){
                    $(obj).css('display','');
                    for(var i in citylist){
                        $(obj).append('<option value='+citylist[i]['areaID']+'>'+citylist[i]['areaName']+'</option>');
                    }
                }else{
                    $(obj).css('display','none');
                }
                if(child){
                    $(child).css('display','none');
                }
            }else if(child){
                var citylist = city[pid];
                if(citylist){
                    $(child).css('display','');
                    for(var i in citylist){
                        $(child).append('<option value='+citylist[i]['areaID']+'>'+citylist[i]['areaName']+'</option>');
                    }
                }else{
                    $(child).css('display','none');
                }
            }

        }

    }